package org.mc.api.es;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.mc.common.data.PagedDTO;
import org.mc.common.data.ResultData;
import org.mc.request.es.AccountRequest;
import org.mc.response.es.AccountDTO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "/AccountServiceV1", tags = "AccountServiceV1", description = "账户")
@FeignClient(value = "mc-es")
public interface AccountServiceV1 {

    @RequestMapping(value = "/v1/i/user/add", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "添加账户", notes = "添加账户", httpMethod = "POST", tags = "AccountServiceV1")
    ResultData add(@RequestBody AccountRequest accountRequest);

    @RequestMapping(value = "/v1/i/user/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "查询账户", notes = "查询账户", httpMethod = "GET", tags = "AccountServiceV1")
    ResultData<AccountDTO> get(@ApiParam(value = "ID", required = true) @PathVariable(value = "ID") Long id);

    @RequestMapping(value = "/v1/i/user/page", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "查询账户（分页）", notes = "查询账户（分页）", httpMethod = "GET", tags = "AccountServiceV1")
    ResultData<PagedDTO<List<AccountDTO>>> getPage(@ApiParam(value = "这是当前页数")
                                                   @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
                                                   @ApiParam(value = "这是每页条数")
                                                   @RequestParam(value = "pageSize", defaultValue = "2") int pageSize);

}